import time

from adb_cmd import *
from gold import *
import aircv as ac
import re

def exec_cmd(cmd):
    try:
        print(cmd)
        cmd = os.popen(cmd)
        cmd_result = cmd.read()
        cmd.close()
        return cmd_result
    except:
        print("执行命令报错了")
    return "------------"


def main():
    # 逛街
    for j in range(1, 400):
        adb_swipe(100, 1300, 100, 676)
        time.sleep(4)
        print(str(time.strftime('%H:%M:%S', time.localtime(time.time()))) + "   执行次数 -----> ", j)
    # 逛街end


def video():
    # 滑动浏览视频
    for j in range(1, 800):
        print(str(time.strftime('%H:%M:%S', time.localtime(time.time()))) + "   执行次数 -----> ", j)
        adb_swipe(500, 1400, 500, 376)
        jg_time = random.randint(20, 36)
        print('间隔时间'+str(jg_time))
        time.sleep(jg_time)
    # 滑动浏览视频end


def xiaoshuo():
    # 滑动浏览视频
    for j in range(1, 800):
        adb_swipe(random.randint(850, 890), random.randint(1590, 1630), random.randint(150, 200), random.randint(1100, 1190))
        # time.sleep(random.randint(8, 13))

        jg_time = random.randint(8, 13)
        print(str(time.strftime('%H:%M:%S', time.localtime(time.time()))) + "   执行次数 -----> ", j,'间隔时间' + str(jg_time))
        time.sleep(jg_time)
    # 滑动浏览视频end


if __name__ == '__main__':
    # 0 小米 1华为
    # set_device(['-s H6D5T15525001198', '-s SJE5T17503011219'])
    # 华为白色
    # set_device(['-s SJE5T17503011219'])
    # 华为棕色
    # set_device(['-s H6D5T15525001198'])
    # 小米
    set_device(['-s 41af34c7'])
    # 逛街
    # main()
    # video()
    # xiaoshuo()

    for j in range(1, 200):
        # WeChat 首页位置可能会变 微信自动取消关注的公众号
        adb_click(740, 333)
        time.sleep(2)
        adb_click(999, 169)
        time.sleep(2)
        adb_click(580, 333)
        time.sleep(2)

        # 取消关注  已关注列表
        adb_click(444, 1484)
        time.sleep(2)
        adb_click(999, 169)
        time.sleep(2)
        # adb_click(222, 800)
        adb_click(999, 169)
        time.sleep(1)
        adb_click(700, 1960)

        time.sleep(1)
        adb_click(777, 1300)
        time.sleep(3)







